

def insert(mydict, table):
    values = ', '.join(['%s'] * len(mydict))  # 用于替换记录值
    columns = ', '.join(mydict.keys())  # 字段名
    sql = "INSERT INTO %s (%s) VALUES (%s)" % (table, columns, values)
    return sql
